package com.jack006.admin.service.impl;

import com.jack006.admin.repository.FriendLinkRepository;
import com.jack006.admin.service.FriendLinkService;
import com.jack006.enums.YesOrNo;
import com.jack006.pojo.mo.FriendLinkMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname FriendLinkServiceImpl
 * @Description 友情链接实现类
 * @Date 2021-07-02 22:13
 * @Created by jack
 */
@Service
public class FriendLinkServiceImpl implements FriendLinkService {

    @Autowired
    private FriendLinkRepository friendLinkRepository;

    @Override
    public void saveOrUpdateFriendLink(FriendLinkMO friendLinkMO) {
        friendLinkRepository.save(friendLinkMO);
    }

    @Override
    public List<FriendLinkMO> queryAllFriendList() {
        return friendLinkRepository.findAll();
    }

    @Override
    public void delete(String linkId) {
        friendLinkRepository.deleteById(linkId);
    }

    @Override
    public List<FriendLinkMO> queryPortalAllFriendList() {
        return friendLinkRepository.getAllByIsDelete(YesOrNo.NO.type);
    }
}
